import java.util.Scanner;

public class LogIn {
    public static void uesrLogin(String name,String passworld)throws PassWorldExpection,UserNameExpection {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入您的用户名");
        String tempName = scanner.nextLine();
        System.out.println("请输入您的密码");
        String tempPassWorld = scanner.nextLine();
        
        //User tempUser = new User(tempName,tempPassWorld);
        if (!tempName.equals(name)) {
            throw new PassWorldExpection("输入用户名错误，无法登录");
        }
        if (!tempPassWorld.equals(passworld)) {
            throw new PassWorldExpection("输入密码错误，无法登录");
        }
    }
    
    public static void main(String[] args) {
        //User user = new User("tangyu","12345");
        try {
            uesrLogin("tangyu","12345");
        } catch (PassWorldExpection e) {
            //throw new RuntimeException(e);
            e.printStackTrace();
        } catch (UserNameExpection e) {
            //throw new RuntimeException(e);
            e.printStackTrace();
        }
        
    }
}
